﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Fast.Framework.Models
{

    /// <summary>
    /// 数据库类型
    /// </summary>
    [Flags]
    public enum DbType
    {
        /// <summary>
        /// SQLServer
        /// </summary>
        SQLServer = 0,

        /// <summary>
        /// MySQL
        /// </summary>
        MySQL = 1,

        /// <summary>
        /// Oracle
        /// </summary>
        Oracle = 2,

        /// <summary>
        /// PostgreSQL
        /// </summary>
        PostgreSQL = 3,

        /// <summary>
        /// SQLite
        /// </summary>
        SQLite = 4
    }

    /// <summary>
    /// 数据库符号映射
    /// </summary>
    public static class DbSymbolMapper
    {

        /// <summary>
        /// 参数
        /// </summary>
        public readonly static Dictionary<DbType, string> parameter;

        /// <summary>
        /// 识别
        /// </summary>
        public readonly static Dictionary<DbType, string> identify;

        /// <summary>
        /// 构造方法
        /// </summary>
        static DbSymbolMapper()
        {
            parameter = new Dictionary<DbType, string>()
            {
                { DbType.SQLServer,"@"},
                { DbType.MySQL,"@"},
                { DbType.Oracle,":"},
                { DbType.PostgreSQL,"@"},
                { DbType.SQLite,"@"}
            };
            identify = new Dictionary<DbType, string>()
            {
                { DbType.SQLServer,"[]"},
                { DbType.MySQL,"``"},
                { DbType.Oracle,"\"\""},
                { DbType.PostgreSQL,"\"\""},
                { DbType.SQLite,"[]"}
            };
        }
    }
}
